package org.casaca.checkbackup.core.task;

public class TaskManager {

	public static void executeWithoutThread(Task task){
		task.run();
	}
	
	public static void executeWithoutThread(TaskGroup taskgroup){
		Task[] tasks = new Task[taskgroup.activeCount()];
		taskgroup.enumerate(tasks);
		for (int i = 0; i < tasks.length; i++) {
			tasks[i].run();
		}
	}
	
	public static void executeWithThread(Task task){
		task.start();
	}
	
	public static void executeWithThread(TaskGroup taskgroup){
		Task[] tasks = new Task[taskgroup.activeCount()];
		taskgroup.enumerate(tasks);
		for (int i = 0; i < tasks.length; i++) {
			tasks[i].start();
		}
	}
}
